﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EIIS.Infrastructure.Model.System;
using EIIS.Infrastructure.Service.System;
using EIIS.Infrastructure.Repositories.System;

namespace EIIS.Infrastructure.Service.Implement
{
    public class DicCategoryManager:GenericManagerBase<DicCategory>,IDicCategoryManager
    {
        public IList<DicCategory> LoadAllByPage(out long total, int page, int rows, string order, string sort)
        {
           return ((IDicCategoryRepository)(this.CurrentRepository)).LoadAllByPage(out total, page, rows, order, sort).ToList();
        }        

        public new DicCategory Get(object id)
        {
            DicCategory temp = ((IDicCategoryRepository)(this.CurrentRepository)).Get(id);
            if (!string.IsNullOrEmpty(temp.ParentId))
            {
                DicCategory parent = ((IDicCategoryRepository)(this.CurrentRepository)).Get(temp.ParentId);
                temp.ParentName = parent.Name;
            }
            else
            {
                temp.ParentName = "";
            }
            return temp;
        }
    }
}
